package com.enhe.gck.fg;

import com.enhe.gck.communal.PublicMethod;
import com.enhe.gck.communal.PublicReturn;
import com.enhe.gck.pojo.Batch;
import com.kuangkie.carbon.panel.CarbonPanel;
import com.kuangkie.carbon.record.FGRecord;
import org.springframework.stereotype.Repository;
import com.kuangkie.carbon.fg.FuncGroupContext;
import com.kuangkie.carbon.fg.ImproveResultFactory;
import com.kuangkie.carbon.fg.SecondRoundImproveFuncGroup;
import com.kuangkie.carbon.record.FGRecordComplexus;
import com.kuangkie.carbon.record.ProRecord;
import com.enhe.gck.CarbonBaseConstant; //模型Code
import com.enhe.gck.CarbonEnumKeyValue; //枚举字典信息
import com.enhe.gck.CarbonRelationType; //关系类型Code
import com.enhe.gck.item.BatchHWANE20386Item; // 模型属性Code

@Repository(value = "hwane20386366042330866425862")
public class BatchHWANE20386BNB implements SecondRoundImproveFuncGroup{
	
	@Override
	public void secondImprove(FuncGroupContext context, ProRecord proRecord, FGRecordComplexus recordComplexus,
			ImproveResultFactory improveResultFactory) {
		Batch info=proRecord.getBean(Batch.class);
		if(proRecord.isNew()){
			if(context.getUserCode()==null){
				PublicMethod.returnMessage(improveResultFactory, PublicReturn.USER_1);
				return;
			}
			improveResultFactory.getCurrentProRecordOpsBuilder()
					.addRelation(CarbonRelationType.RR_出场批次_添加账户_系统用户,context.getUserCode());
//			FGRecord oldInfo=PublicMethod.query(CarbonBaseConstant.出场批次_ccpc)
//					.addEqual(BatchHWANE20386Item.基本属性组_水泥编号,info.getNumber())
//					.addEqual(BatchHWANE20386Item.基本属性组_删除,false)
//					.goBack().queryARecord();
//			if(oldInfo!=null){
//				PublicMethod.returnMessage(improveResultFactory, PublicReturn.Batch_1);
//			}
			improveResultFactory.getCurrentProRecordOpsBuilder().putAttribute(BatchHWANE20386Item.基本属性组_剩余数量,proRecord.getBigDecimal(BatchHWANE20386Item.基本属性组_数量));
		}
	}
}
